package epin.fujiajun.sort.quick;

import epin.fujiajun.data.Array;
import epin.fujiajun.sort.ArraySortBase;

/**
 * Created by DELL on 2017/9/7.
 */
public abstract class Original extends ArraySortBase {

    public abstract int partition(Array[] a, int lo, int hi);

    @Override
    public void sort(Array[] a) {
        sort(a, 0, a.length - 1);
    }

    private void sort(Array[] a, int lo, int hi){
        if (hi <= lo)
            return;

        int j = partition(a, lo, hi);
        sort(a, lo, j - 1);
        sort(a, j + 1, hi);
    }
}
